# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        潘炎珍  
# Name:         demo14
# Description:
# Author:       98745
# Date:         2019/3/16
#-------------------------------------------------------------------------------

import imaplib
import base64
connection=imaplib.IMAP4_SSL('imap.qq.com',993)
user='2105642563@qq.com'
password='52013142828258'
try:
    connection.login(user.password)
except Exception as err:
    print('登陆失败',err)
connection.print_log()
res,data=connection.list()
print('response code',data)
res,data=connection.select('INBOX')
print(res,data)
print(data[0])
res,msg_ids=connection.search(None,'ALL')
print(res,msg_ids)
res,msg_data=connection.fetch(data[0],'(UID BODY[TEXT])')
print(msg_data)
connection.logout()